# Contributor: Danilo Falcão <danilo@falcao.org>
# Contributor: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=ufw
pkgver=0.36.2
pkgrel=0
pkgdesc="Uncomplicated CLI tool managing a netfilter firewall"
url="https://launchpad.net/ufw"
arch="noarch"
license="GPL-3.0-or-later"
options="!check" # 3 tests fails
depends="iptables python3"
subpackages="$pkgname-doc $pkgname-openrc $pkgname-bash-completion:bashcomp:noarch $pkgname-pyc"
source="https://launchpad.net/ufw/${pkgver%.*}/$pkgver/+download/ufw-$pkgver.tar.gz
	$pkgname.initd
	fix-lib_path.patch
	iptables-version.patch
	"

check() {
	sh run_tests.sh
}

package() {
	python3 setup.py install --root="$pkgdir"

	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	chmod 644 "$pkgdir"/etc/ufw/*.rules

	install -Dm0644 "$builddir"/shell-completion/bash \
		"$pkgdir"/usr/share/bash-completion/completions/ufw
}

sha512sums="
43c5f31c98681e006b821f30e3d729eec0bbe21eeea833916b6ab18899201e5e243e5077ace32480b2a222b69b2c383ff95b7a50241053d025d68f34c25cd60b  ufw-0.36.2.tar.gz
c2f1a4e4f2de3f71ef4626645acb1805df6194ee99bcbcd024092d791ccf1391e65276718f0578b1647fbc8439aa6d962f7485273c4875f5109905d9bca2fe09  ufw.initd
1f3f884f219dad9f2a8eaa1c02d90e82ac1646910c5a30b37cd70fc228f885aa147ef00b6e45d30bc0bdd7f2f19bc8f4db1fe0b63917ee013c07ab953744006a  fix-lib_path.patch
68f86033fc2a98c81d83f65c39b9f4b9417d02b70dbced18bf6f8aa9bb327baf66e33d55b381849363fb9c87a2f757a22588d53fa0e1689f21daf802273096c4  iptables-version.patch
"
